package com.lk.springboot.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lk.springboot.bean.Admin;
import com.lk.springboot.bean.Category;
import com.lk.springboot.bean.Users;
import com.lk.springboot.dao.AdminMapper;
import com.lk.springboot.dao.CategoryMapper;
import com.lk.springboot.dao.UsersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller
public class HelloController {

    @Autowired
    AdminMapper adminMapper;

    @RequestMapping("/index")
    public String hello(Model m) throws Exception {
        return "hello";
    }

    @RequestMapping("/login")
    public String login(Admin admin) throws Exception {
        String s = adminMapper.get(admin);
        if (s == null)
            return "hello";
        else
            return "redirect:listCategory";
    }


}
